<?php
require_once('../../conf/config.php.inc');
require_once(SYBMAS_LIB_PATH.'/liblogin.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/layout.php.inc');
require_once(SYBMAS_LIB_PATH.'/libsybmas.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/menu.php.inc');
require_once('libtablas.php.inc');
verificar_inicio_sesion();
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="<?php echo LAYOUT_URI?>/sybmasstyle.css">
<script src="<?php echo LAYOUT_URI?>/jquery-1.2.1.min.js" type="text/javascript"></script>
<script src="<?php echo LAYOUT_URI?>/menu-collapsed.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo LAYOUT_URI?>/style.css" >
<script src="<?php echo JAVASCRIPT_URI?>/tabs/tabs.js"
	type="text/javascript"></script>
<script type="text/javascript" src="<?php echo JAVASCRIPT_URI?>/commons.js"></script>
<script type="text/javascript" src="<?php echo JAVASCRIPT_URI?>/validacionFormularios.js"></script>
<title>.:: Sybmas - Consulta de Logins</title>
<!--[if lt IE 8]>
   <style type="text/css">
   li a {display:inline-block;}
   li a {display:block;}
   </style>
   <![endif]-->
</head>
<body>
<script src="<?php echo JAVASCRIPT_URI?>/tooltip/wz_tooltip.js"
	type="text/javascript"></script>
<center>
<div id="container">
<div id="header">
<?php generar_header();?>
</div>
<div id="scene">
<div id="modulos">
<ul id="menu" style="width: 150px;">
<?php generar_menu();?>
</ul>
</div>

<div id="title">Consulta de Logins</div>
<div id="main">
<h2>Consultar Logins</h2>
<?php //$dbname=form_cambiarbd();?> 

<form name="formAltaLogin" method="POST" action=consultaLogin.php>
<table width="80%" border="0">
  <tr>
    <td width="90">Nombre del Login:</td>
    <td width="40"><input type="text" name="sybmas_loginname" maxlength="30" 
    		onkeypress="return onKeyPressPermiteAlfaNumericosNoEspacios(event)"></td>
    <td></td>    
  
      
	<td><a href="#" onclick="formAltaLogin.submit();" ><span onmouseover="Tip('Buscar Login')" onmouseout="UnTip()">		
	<img src="<?php echo IMG_URI?>/page_white_magnify.png"
		 alt="Buscar" width="18" height="18" border="0" alt="Buscar"></span></a> Buscar</td>		        					     
  </tr>
</table>
</form> 
<p align=right><a href="alta_login.php"><img src="<?php echo IMG_URI?>/user_added.png" width="18" height="18" border="0"> Crear Login</a></p>
<hr >
<?php 
	foreach($_POST as $key=>$value){
		$$key=$value;		
	}

	$query="SELECT suid,name,dbname,fullname from master..syslogins ";
	
	if(!empty($sybmas_loginname)){	
		$query.="WHERE name LIKE '%{$sybmas_loginname}%'";		
	}		
?>
<?php
//$cambio_bd_exitoso=true;
$sybuser_connection=start_default_sybuser_connection();
//if($dbname){
	//$cambio_bd_exitoso=sybase_select_db($dbname,$sybuser_connection);
//}
//if($cambio_bd_exitoso){
	$result=sybase_query($query,$sybuser_connection);
?>
<table width="80%" border="1">
	<tr>	    
		<th bgcolor="#8BA7C2">suid</th>
		<th bgcolor="#8BA7C2">name</th>
		<th bgcolor="#8BA7C2">dbname</th>
		<th bgcolor="#8BA7C2">fullname</th>	
		<th bgcolor="#8BA7C2"></th>
	    <th bgcolor="#8BA7C2"></th>	
	</tr>
	<?php
	while($data=sybase_fetch_array($result)){						
		?>	
	<tr>
	    <td><?php echo $data['suid']?></td>
		<td><?php echo $data['name']?></td>
		<td><?php echo $data['dbname']?></td>
		<td><?php echo $data['fullname']?></td>
		
	    <td width="18">
		<a href="modificarLogin.php?suid=
		<?php 
			echo $data['suid'];
			//echo "&name=$name";	
			?>">
		 
		    <span onmouseover="Tip('Modificar Login')" onmouseout="UnTip()"><img src="<?php echo IMG_URI?>/page_white_edit.png"
			alt="Modificar Login" width="18" height="18" border="0" alt="Editar"></span></a></td>
				
		<td width="18">	
		<a href="bajaLogin.php?suid=
		<?php 
			echo $data['suid'];
			 //if($name){
			   //echo "&name=$name";	
			//}
		?>">
		<span onmouseover="Tip('Eliminar Login')" onmouseout="UnTip()"><img src="<?php echo IMG_URI?>/page_white_delete.png"
			alt="Eliminar Login" width="18" height="18" border="0" alt="Eliminar"></span>
		</a></td>			
	</tr>
	<?php
	}
	?>	
</table>         
<?php
  sybase_free_result($result);  
?> 

<?php
//Cerrando conexiones a la base de datos
sybase_close($sybuser_connection);
?></div>
</div>
<?php generar_footer();?></div>
</center>
</body>
</html>